


#if !defined( __WXCHARTWINDOW_H__ )
#define __WXCHARTWINDOW_H__


#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
#pragma interface "chartwindow.h"
#endif

#ifdef __BORLANDC__
#pragma hdrstop
#endif

#ifndef WX_PRECOMP
    #include <wx/window.h>
    #include <wx/scrolwin.h>
#endif

#include "wx/chart.h"


class wxChartSizes;



class WXDLLIMPEXP_CHART wxChartWindow : public wxWindow

{
public:

	wxChartWindow(wxScrolledWindow *parent = NULL, bool usegrid = true);




	void Add(wxChartPoints* cp);
	void Clear();




	ChartValue GetMaxX() const;
	ChartValue GetMinX() const;
	ChartValue GetMaxY() const;
	ChartValue GetMinY() const;
	int GetNumBarPoints() const;
	int GetNumBar3DPoints() const;

    // Get/Set virtual size
    //---------------------
    ChartValue GetVirtualMaxX() const;
    ChartValue GetVirtualMinX() const;
    ChartValue GetVirtualMaxY() const;
    ChartValue GetVirtualMinY() const;
    ChartValue GetVirtualWidth() const;

    // Get/Set zoom
    //-------------
    void SetZoom(double z);
    double GetZoom() const;

    // Set sizes for drawing
    //----------------------
    void SetSizes(wxChartSizes *sizes);
    wxChartSizes *GetSizes() const;



	void Draw(CHART_HPAINT hp, int x = 0, int y = 0);

private:
	wxChart m_Chart;
	wxScrolledWindow *m_WinParent;
    bool m_UseGrid;

    // Draw helper function
    //-----------------
    void DrawHLines(CHART_HPAINT hp, CHART_HRECT hr);



    void OnPaint(wxPaintEvent &event);
    void OnMouse(wxMouseEvent &event);


    DECLARE_DYNAMIC_CLASS(wxChartWindow)

    DECLARE_EVENT_TABLE()
};





//----------------------------------------------------------------------E-+++
inline void wxChartWindow::Add(
	wxChartPoints* cp
)
{
	m_Chart.Add( cp );
}


//----------------------------------------------------------------------E-+++
inline void wxChartWindow::Clear()
{
	m_Chart.Clear();
}


//----------------------------------------------------------------------E-+++
inline ChartValue wxChartWindow::GetMaxX() const
{
	return ( m_Chart.GetMaxX() );
}


//----------------------------------------------------------------------E-+++
inline ChartValue wxChartWindow::GetMinX() const
{
	return ( m_Chart.GetMinX() );
}


//----------------------------------------------------------------------E-+++
inline ChartValue wxChartWindow::GetMaxY() const
{
	return ( m_Chart.GetMaxY() );
}


//----------------------------------------------------------------------E-+++
inline ChartValue wxChartWindow::GetMinY() const
{
	return ( m_Chart.GetMinY() );
}



inline int wxChartWindow::GetNumBarPoints() const
{
	return ( m_Chart.GetNumBarPoints() );

}



inline int wxChartWindow::GetNumBar3DPoints() const
{
	return ( m_Chart.GetNumBar3DPoints() );
}


//----------------------------------------------------------------------E-+++
inline void wxChartWindow::SetZoom(
	double z
)
{
	m_Chart.SetZoom( z );
}


//----------------------------------------------------------------------E-+++
inline double wxChartWindow::GetZoom() const
{
    return m_Chart.GetZoom();
}


//----------------------------------------------------------------------E-+++
inline void wxChartWindow::SetSizes(
    wxChartSizes *sizes
)
{
    m_Chart.SetSizes( sizes );
}


//----------------------------------------------------------------------E-+++
inline wxChartSizes *wxChartWindow::GetSizes() const
{
    return m_Chart.GetSizes();
}


//----------------------------------------------------------------------E-+++
inline ChartValue wxChartWindow::GetVirtualMaxX() const
{
    return GetMaxX();
}


//----------------------------------------------------------------------E-+++
inline ChartValue wxChartWindow::GetVirtualMinX() const
{
    return GetMinX();
}


//----------------------------------------------------------------------E-+++
inline ChartValue wxChartWindow::GetVirtualMaxY() const
{
    return GetMaxY();
}


//----------------------------------------------------------------------E-+++
inline ChartValue wxChartWindow::GetVirtualMinY() const
{
    return GetMinY();
}

#endif // __WXCHARTWINDOW_H__
